package cmd

import (
	"fmt"
	"homework5/mycommand/myCobra"
	"os"
)
var(
	rootCmd = &myCobra.Command{
		Use:   "mycode",
		Short: "a very single app",
		Long: `A longer description that spans multiple lines and likely contains `, //命令的详细介绍

		// 使用本命令需要执行的线管代码写在这里
		Run: func(cmd *myCobra.Command, args []string) {
			// Do Stuff Here
			fmt.Printf("It is easy process used to print daily knowledge.\n")
			if(author != "YOUR NAME"){
				fmt.Printf("Created by %s\n",author)
			}
		},
	}
	author string
)

func MyExecute() {
	if err := rootCmd.Execute(); err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
}

func init(){
	rootCmd.PersistentFlags().StringVarP(&author, "author", "a", "YOUR NAME", "author name for copyright attribution")
	rootCmd.AddCommand(timeCmd)
	rootCmd.AddCommand(addCmd)
}
